import React from 'react';
import { Route, Redirect } from "react-router-dom";

function AuthCheck(props){
    let {path,component:Component} = props
    let token = sessionStorage.getItem('mytoken')
    return(
        <Route path={path} render={()=>{return token?<Component/>:<Redirect to="/login"></Redirect>}}></Route>
    );
}

export default AuthCheck


